package zb.controller;

import org.springframework.web.bind.annotation.*;
import zb.pojo.Order;
import zb.service.OrderService;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class Ordercontroller {
    @Resource
    OrderService orderService;
    @RequestMapping("/showUserOrder/{uid}")
    public List<Order>ShowUserOrder(@PathVariable("uid") Integer uid){
        System.out.println("8082查询");
        return orderService.getOrderByuser(uid);
    }
    @RequestMapping("saveOrder")
    public Integer saveOrder(@RequestBody Order order){
        System.out.println("本地order添加");
        return orderService.saveOrder(order);
    }
    @RequestMapping("/delOrder/{id}")
    public Integer delOrder(@PathVariable("id") Integer id){
        System.out.println("本地order删除");
        int num= orderService.delOrder(id);
        return num;
    }
    @RequestMapping("/updateOrder")
    public Integer updateOrder(@RequestBody Order order){
        System.out.println("本地order 更新");
        return orderService.updateOrder(order);
    }
}
